package com.gjzt.business.media.controller;

import net.sf.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.eastdigit.servlet.RequestAttribute;
import com.eastdigit.servlet.Response;
import com.eastdigit.servlet.ReqBean;
import com.gjzt.business.media.service.MediaMarkTypeService;

@Controller
@RequestMapping(value = "")
public class MediaMarkTypeController {

    @Autowired
    private MediaMarkTypeService mediaMarkTypeService;

    /**
     * 查询
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/markType/query")
    @ResponseBody
    public JSONObject queryMediaMarkType(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        return Response.response(mediaMarkTypeService.findMediaMarkType(reqBean));
    }

    /**
     * 查询顶层分类
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/markType/queryTopType")
    @ResponseBody
    public JSONObject queryTopType(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        return Response.response(mediaMarkTypeService.queryTopType(reqBean));
    }

    /**
     * 商圈树
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/anon/markType/tree")
    @ResponseBody
    public JSONObject tree(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        return Response.response(mediaMarkTypeService.queryTree(reqBean));
    }

    /**
     * 添加
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/markType/add")
    @ResponseBody
    public JSONObject addMediaMarkType(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        mediaMarkTypeService.addMediaMarkType(reqBean);
        return Response.responseSuccess();
    }

    /**
     * 修改
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/markType/update")
    @ResponseBody
    public JSONObject updateMediaMarkType(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        mediaMarkTypeService.updateMediaMarkType(reqBean);
        return Response.responseSuccess();
    }

    /**
     * 删除
     *
     * @param reqBean
     * @return
     */
    @RequestMapping(value = "/markType/delete")
    @ResponseBody
    public JSONObject removeMediaMarkType(final @RequestAttribute(ReqBean.NAME) ReqBean reqBean) {
        mediaMarkTypeService.removeMediaMarkType(reqBean);
        return Response.responseSuccess();
    }

    //TODO 其他功能
}